using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace BB.Processes.Models.Mapping
{
    public class ApostaMap : EntityTypeConfiguration<Aposta>
    {
        public ApostaMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            // Table & Column Mappings
            this.ToTable("Apostas");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.UserId).HasColumnName("UserId");
            this.Property(t => t.JogoId).HasColumnName("JogoId");
            this.Property(t => t.HomeScore).HasColumnName("HomeScore");
            this.Property(t => t.AwayScore).HasColumnName("AwayScore");
            this.Property(t => t.Score).HasColumnName("Score");
            this.Property(t => t.Result).HasColumnName("Result");

            // Relationships
            this.HasRequired(t => t.Jogo)
                .WithMany(t => t.Apostas)
                .HasForeignKey(d => d.JogoId);
            this.HasRequired(t => t.UserProfile)
                .WithMany(t => t.Apostas)
                .HasForeignKey(d => d.UserId);

        }
    }
}
